//
//  MYXHomepageVocherVIewModel.m
//  meiyinxiang
//
//  Created by 媒印象 on 2017/12/20.
//  Copyright © 2017年 hbjApple. All rights reserved.
//

#import "MYXHomepageVocherVIewModel.h"
@implementation MYXHomepageVocherVIewModel
- (id)initWithVocherModel:(MYXHomepageVocherModel *)model{
    if (self = [super init]) {
        self.vocherId = model.vocherId;
        NSString *lat = [NSString stringWithFormat:@"%.5f",model.latitude];
        NSString *lon = [NSString stringWithFormat:@"%.5f",model.longitude];
        self.latitude = lat.floatValue;
        self.longitude = lon.floatValue;
        self.radius = model.radius;
        self.smoney  = model.smoney;
        self.title = model.title;
        self.uid = model.uid;
        self.VocherImg = [UIImage imageNamed:@"officail_vocher"];
        NSString *sucessImg = [NSString stringWithFormat:@"vocher%@yuan",self.smoney];
        self.sucessImg = [UIImage imageNamed:sucessImg];
        self.title = model.title;
        
    }
    return self;
}
- (void)getVocherWithResult:(vocherFinishBolck)result{
    NSString *lat = [NSString stringWithFormat:@"%f",self.latitude];
    NSString *lon = [NSString stringWithFormat:@"%f",self.longitude];
    [[MYXHttpManager shared] getMYXHomepageVochersWithlat:lat
                                                      lon:lon
                                                      pid:self.vocherId
                                                   Result:^(BOOL sucess, NSString *msg) {
                                                       if (sucess) {
                                                           result(sucess,msg);
                                                       }else{
                                                           result(sucess,msg);
                                                           ShowSVProgressErrorMessage(msg);
                                                         //  [SVProgressHUD showErrorWithStatus:msg];
                                                       }
                                                   }];
}
@end
